﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Manage_Service_setcurrpaper : ManagePageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(Request.QueryString["id"])) //得到要设置的试卷 deptid
        {
            string id = Request.QueryString["id"].Trim();
            //获取该试卷下部门，
            string deptid = Request.QueryString["deptid"].Trim();

            //将该部门下所有的试卷均设置为非当前考试状态
            string sql = "UPDATE Paper SET IsCurrExam=0 WHERE DepartmentID=" + deptid.Trim() + "";
            Exam.Core.DAL.DataProvider.ExecuteSql(sql);
            //将试卷设置为当前考试状态
            sql = "UPDATE Paper SET IsCurrExam=1 WHERE PaperID=" + id + " AND DepartmentID=" + deptid.Trim();
            Exam.Core.DAL.DataProvider.ExecuteSql(sql);

            //Tools.WriteTxt(id, Server.MapPath("~/App_Data/currentpaper.txt"));
            Response.Write("ok");
        }
        else
        {
            Response.Write("erro");
        }
        Response.End();

    }
}